/*
 * app.lockenabler2.ImageAdapter.java
 * 
 * Copyright (C) 2010-11 kfv 
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 3 of the License.
 * 
 */

package app.lockenabler2;

import android.content.Context;
import android.net.Uri;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;

public class ImageAdapter extends BaseAdapter {
    private Context mContext;
    private int mXY;

    public static Uri[] ImageIds = {
        Uri.parse("android.resource://app.lockenabler2/"+R.drawable.icon_red),
        Uri.parse("android.resource://app.lockenabler2/"+R.drawable.icon_orange),
        Uri.parse("android.resource://app.lockenabler2/"+R.drawable.icon_yellow),
        Uri.parse("android.resource://app.lockenabler2/"+R.drawable.icon_green),
        Uri.parse("android.resource://app.lockenabler2/"+R.drawable.icon_lightblue),
        Uri.parse("android.resource://app.lockenabler2/"+R.drawable.icon_blue),
        Uri.parse("android.resource://app.lockenabler2/"+R.drawable.icon_purple),
        Uri.parse("android.resource://app.lockenabler2/"+R.drawable.icon_white),
        Uri.parse("android.resource://app.lockenabler2/"+R.drawable.icon_black),
        Uri.parse("android.resource://app.lockenabler2/"+R.drawable.icon_transparent),
        Uri.parse("android.resource://app.lockenabler2/"+R.drawable.icon_gallery)
    };

    public ImageAdapter(Context c, int i) {
        mContext = c;
        mXY = i;
    }

    public int getCount() {
        return ImageIds.length;
    }

    public Object getItem(int position) {
        return position;
    }

    public long getItemId(int position) {
        return position;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        ImageView i = new ImageView(mContext);
        i.setLayoutParams(new Gallery.LayoutParams(mXY, mXY));
        i.setImageURI(ImageIds[position]);
        return i;
    }
}
